package com.wkedu.recommend.controller;

import com.wkedu.recommend.entity.ProductTable;
import com.wkedu.recommend.recommender.RecommenderS;
import com.wkedu.recommend.service.MemberUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 港港
 * @version 1.0
 * @date 2021/8/12 下午7:12
 */
@RestController
@RequestMapping("/recommend")
public class RecommendController {

    @Autowired
    private MemberUserService memberUserService;

    @GetMapping("/info")
    public List<ProductTable> getRecommendInfo(@RequestParam String name){
        int memberUserId = memberUserService.selectIdByName(name);
        Integer integer = new Integer(memberUserId);
        RecommenderS recommenderS = new RecommenderS();
        List<ProductTable> login = recommenderS.login(integer);
        return login;
    }

}
